import requests

DEEPSEEK_API_KEY = "sk-17ff3470e2ee48d4bef084de92a5d673"
API_URL = "https://api.deepseek.com/v1/chat/completions"

headers = {
    "Authorization": f"Bearer {DEEPSEEK_API_KEY}",
    "Content-Type": "application/json"
}

data = {
    "model": "deepseek-chat",  # 根据实际模型名修改
    "messages": [
        {"role": "user", "content": "你好"}
    ]
}

response = requests.post(API_URL, headers=headers, json=data)
# response = requests.post(API_URL, json=data)

if response.status_code == 200:
    result = response.json()
    print(result['choices'][0]['message']['content'])
else:
    print(f"请求失败，状态码：{response.status_code}, 错误信息：{response.text}")